<%@page import="javax.inject.Scope"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ include file="../include/header.jsp" %>
<div id="main">
    <div id="container">
        <div id="content">
            <div id="comments">
                <div id="comments-list" class="comments">
                    <h3>Notifications des commentaires</h3>
                    <ol>
                        <c:if test="${ !empty requestScope['commentaires']}">
                            <c:forEach var="commentaire" items="${requestScope['commentaires']}">
                                <li class="comment c1 c-y2009 c-m08 c-d17 c-h15 depth-1">
                                    <div class="comment-author">
                                        <img alt='' src='upload/${commentaire.photo.album.auteur.id}/${commentaire.photo.album.id}/${commentaire.photo.pathThumbHome}' class='photo avatar avatar-80 photo' height='80' width='80' />
                                        <span class="fn n">
                                            ${commentaire.auteur.login}
                                        </span>
                                        <span>
                                            <c:if test="${!commentaire.vue}">
                                                - <i>Nouveau!</i>
                                            </c:if>

                                        </span>
                                    </div>
                                    <div class="comment-meta">
                                        ${commentaire.creationToString}
                                        <span class="meta-sep">|</span>
                                        <a href="PhotoServlet?action=view&IdPhoto=${commentaire.photo.id}">
                                            Voir
                                        </a>
                                    </div>
                                    <div class="comment-content">
                                        <p>${commentaire.texte}</p>
                                    </div>
                                </li>
                            </c:forEach>
                            <c:if test="${requestScope['nbCommentaires'] > 10}">
                                <%
                                            int nbCommentaires = Integer.valueOf(request.getAttribute("nbCommentaires").toString());
                                            int max = 10;
                                            for (int i = 0; i <= nbCommentaires / max; i++) {
                                                int first = i*max;
                                                int num = i + 1;
                                                out.println("<a href=\"CommentaireServlet?action=viewNew&first="+ first +"&max="+max+"\">"+num+"</a>");
                                            }
                                %>
                            </c:if>
                        </c:if>
                        <c:if test="${ empty requestScope['commentaires']}">
                            <li class="comment c1 c-y2009 c-m08 c-d17 c-h15 depth-1">
                                Auncun commentaires
                            </li>
                        </c:if>
                    </ol>
                </div><!-- #comments-list .comments -->
            </div><!-- #comments -->
        </div><!-- #content -->
    </div><!-- #container -->
</div><!-- #main -->
<%@ include file="../include/footer.jsp" %>